Element

Element represents an individual block. It can hold a widget and handle operations with it. While setting and removing, a child_dict named dictionary is taken and returned. The format of child_dict is as follows

child_dict = {
    "child": Gtk.Widget,
    "child_name": str,
    "icon": Gtk.Image,
    "header_child": Gtk.Widget or None,
    "provider": Aduct.Provider
}

Here only header_child key is optional.

class Aduct.Element.Element(child_dict=None, use_action_button=True, pack_type=0, **kwargs)

Makes an element based on given properties. Its CSS name is aduct-element.

Parameters:
  • child_dict (dict) – A dictionary object containing properties of child. Given a valid dictionary, the child is added to self while initializing. It is None, when not given.
  • use_action_button (bool) – States whether to use an action button. Default is True.
  • pack_type (Gtk.PackType) – Specfies the position of action button. It can be an integer of value either 0 or 1, which represents Gtk.PackType.START or Gtk.PackType.END respectively. The default value is Gtk.PackType.START.
  • **kwargs – The values to be passed to Gtk.Grid, from which Element is derived.
action_button

Action button that is used to handle interactions with user. Its default name is aduct-element-action_button.

Type:Gtk.Button
child_name

The name of child held by self.

Type:str
pack_type

The position of action button in self.

Type:Gtk.PackType
provider

The provider that produced the child of self.

Type:Provider
Signals
action-clicked
Emitted with an integer when action button of self is clicked. The integer is 1, 2, 3 for LMB, MMB, RMB respectively.
child-added
Emitted when a child is added to self.
child-cleared
Emitted when the child of self is cleared.
child-removed
Emitted when the child of self is removed.

Note

Incase having use_action_button as False, an action button is still created, but is not attached to the self.

clear_child()

Clears the child at self. After clearing, child-cleared signal is emitted.

disable_action_button()

Removes the action button of self. Nothing is done if it is already disabled.

enable_action_button()

Adds the action button of self. Nothing is done if it is already enabled.

get_child()

Gets the child held by self.

Returns:The child of self or None if self has no child.
Return type:Gtk.Widget or None
get_child_name()

Gets the name of child held by self.

Returns:The child name of self or None if self has no child.
Return type:str or None
get_header_child()

Gets the child packed at the header of self.

Returns:The header child of self or None if self has no header child.
Return type:Gtk.Widget or None
get_icon()

Gets the icon representing child held by self.

Returns:The icon of action_button or None if self has no icon for child.
Return type:Gtk.Image or None
get_props()

Gets the properties of child held by self.

Returns:The dictionary that can be later used to build the same interface.
Return type:dict
get_provider()

Gets the provider for child held by self.

Returns:The provider of self or None if self has no child.
Return type:Provider or None
get_type()

Gets the type of self.

Returns:The name of provider.
Return type:str
remove_child()

Removes the child held by self.

By removing a child, all its associated properties like icon, header child are also removed. A child-removed signal is emitted by self after removal.

Raises:ValueError – Raised when self has no child.
Returns:A dictionary with child properties.
Return type:dict
set_child(child_dict)

Sets the child in self from given properties.

If self already has a child, then its cleared before adding this new child. A child-added signal is emitted after addition.

Parameters:child_dict (dict) – A valid dictionary with properties of child.
set_child_name(child_name)

Sets the name of child held by self.

Parameters:child_name (str) – The new name of child.
set_from_props(props)

Sets the interface of self from given properties.

If self already has a child, then its cleared before adding this new child.

Parameters:props (dict) – The dictionary from which properties are set.
set_header_child(header_child)

Sets the header child of self.

Parameters:header_child (Gtk.Widget) – The new header child of self.
set_icon(icon)

Sets the icon of child held by self.

Parameters:icon (Gtk.Image) – The new icon of child.
set_provider(provider)

Sets the provider of child held by self.

Parameters:provider (Provider) – The new provider of child.
type

Used by autodoc_mock_imports.